package my_triangle;

public class SimpleTriangle {
	
	private double a;
	private double b;
	private double c;
	
	private static final int variance = 1; 
	
	public SimpleTriangle (double side1, double side2, double side3)
	{
		if (side3 > side1 && side3 > side2)
		{
			a = side1;
			b = side2;
			c = side3;
		}
		else if (side2 > side1 && side2 > side3)
		{
			a = side1;
			b = side3;
			c = side2;
		}
		else
		{
			a = side2;
			b = side3;
			c = side1;
		}
		
	}
	
	public SimpleTriangle()
	{
		this (0.0, 0.0, 0.0);
	}
	
	public String triangleType()
	{
		String triType;
		if(a == b && b == c)
		{
			triType = "Equilateral";
		}
		else if(a == b || b == c || a == c)
		{
			triType = "Isosceles";
		}
		else
		{
			triType = "Scalene";
		}
		return triType;
	}
	
	public boolean rightTriangle()
	{
		double py_a, py_b, py_c, percent_var;
		
		py_a = a * a;
		py_b = b * b;
		py_c = Math.sqrt(py_a + py_b);
		
		percent_var = (c - py_c) / c * 100;
		percent_var = Math.abs(percent_var);
		
		if (percent_var <= variance)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
}
